<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Amaze UI Admin table Examples</title>
  <meta name="description" content="这是一个 table 页面">
  <meta name="keywords" content="table">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  
  
  <script type='text/javascript' src="../js/jquery-1.7.2.js"></script>  
  <link rel="icon" type="image/png" href="../assets/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="../assets/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" /> 
  <link rel="stylesheet" href="../assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="../assets/css/admin.css"> 
  <!-- <link rel="stylesheet" type="text/css" href="../css/easyui.css"> -->
  <!-- <link rel="stylesheet" type="text/css" href="../css/demo.css"> -->
  <!--  <link rel="stylesheet" type="text/css" href="../css/icon.css"> -->
  <!-- <script src="../js/jquery.easyui.min.js"></script>
  <script src="../js/jquery.min.js"></script> -->
  <script src="../assets/js/amazeui.min.js"></script>
  <script src="../assets/js/app.js"></script>
  
  <script type="text/javascript">
  
  	

  	function init(){
  		
  		var userJudge="${sessionScope.userJudege}";
  	  	var url ="${pageContext.request.contextPath}/loginController/getLoginMessage.do";
  	  	var m="${sessionScope.m}";
  	  	loginMessage(url,m);
  	}
  	function serachinit(){
  		var search=document.getElementById("serach").value;
  		alert(search);
  		var url ="${pageContext.request.contextPath}/loginController/searchLoginMessage.do?name="+search+"";
  	  	var m="${sessionScope.serach}";
  	  	loginMessage(url,m);
  	}
  	
  
  
  	function loginMessage(url,m){ 		
  		$("#main-content").empty();		
		var htmls = "";
					
		$.getJSON(url, function(data) {
			 
			
			htmls+="<form class='am-form'> <form class='am-form'>";
			htmls+=" <table class='am-table am-table-striped am-table-hover table-main'>";
			htmls+="<thead><tr> <th class='table-check'><input type='checkbox' /> </th>";
			htmls+="<th class='table-title'>账号</th><th class='table-title' type='password'>登录时间</th>";
			htmls+="<th class='table-author am-hide-sm-only'>登录IP</th>";
			htmls+="<th class='table-set'>操作</th></tr></thead> <tbody>";
	     	$.each(data, function(m, item) {
	     		
	    	 	htmls+="<tr><td><input type='checkbox' /></td><td>"+item.tUserName+"</td>";
	    	 	htmls+="<td>"+item.tLoginTime+"</td>";
	    	 	htmls+="<td class='am-hide-sm-only'>"+item.tLoginIp+"</td>";
	    	 	htmls+="";
	    	 	htmls+=" <td><div class='am-btn-toolbar'><div class='am-btn-group am-btn-group-xs'>";
	    	 	htmls+="<button class='am-btn am-btn-default am-btn-xs am-text-secondary'>";
	    	 	htmls+="<span class='am-icon-pencil-square-o'></span> 编辑</button>";
	    	 	htmls+="<button class='am-btn am-btn-default am-btn-xs am-hide-sm-only'>";
	    	 	htmls+="<span class='am-icon-copy'></span> 复制</button>";
	    	 	htmls+="<button onclick=\"deleteUser('"+item.tUserName+"')\" class='am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only'>";
	    	 	htmls+="<span class='am-icon-trash-o'></span> 删除</button>";
	    	 	htmls+="</div> </div> </td></tr>";	    	 		    	 		    	 		    	 		
	     	});
	     
	     
	     		htmls+=" </tbody></table><div class='am-cf'>共"+m+"条记录<div class='am-fr'>";
	     		htmls+=" <ul class='am-pagination'><li class='am-disabled'><a href='#'>«</a></li>";
	     		htmls+="<li class='am-active'><a href='#'>1</a></li><li><a href='#'>»</a></li>";
	     		htmls+="</ul> </div></div><hr /><p>注：.....</p></form></div>";	     			     		
		 	$("#main-content").append(htmls);
	 	});  	
		
		if(userJudge=='fail'){
			alert('你没有权限');
		}
		
  	}
  	 function addUser(){
  		
  	window.open('register.jsp', 'newwindow', 'height=200, width=400, top=300, left=300, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no');
  	 }
  	 //用作删除操作的备选
  	/*  function deleteUser(tUserName){
  		 alert(tUserName);
  		
  		 $.ajax({
  			type: 'post',
  			url: '${pageContext.request.contextPath}/loginController/deleteUser.do',
  		 	data: 'tUserName='+tUserName,
  		 	
  	        		async : true, //本次请求是否为异步请求
  		 	success: function (){
  		 		
  		 		alert('删除成功!')
  		 		
  		 	},
  			error : function(){
           	 		//请求失败，执行的操作
       				 }
  			
  			 
  			 
  			 
  		 });
  		getTable();
  		 
  	 } */
  	
  	
  	
  	
  	
  </script>
  
</head>
<body onload="init()">
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->
	
	<!-- 这是header -->
	<%@include file="header.jsp" %>
	<!-- 这是header -->
	<!-- leftside begin -->
	<%@include file="leftside.jsp" %>
	<!-- leftside end -->
	
	
	

  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">用户信息管理</strong> / <small>user-table</small></div>
      </div>

      <hr>

      <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
          <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
              <button onclick="addUser()" type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 增加</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 保存</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-archive"></span> 审核</button>
              <button type="button" class="am-btn am-btn-default"><span class="am-icon-trash-o"></span> 删除</button>
            </div>
          </div>
        </div>       
      
       <div class="am-u-sm-12 am-u-md-3">
          <div class="am-input-group am-input-group-sm">
            <input type="text" class="am-form-field" name="name" id="serach">
          <span class="am-input-group-btn">
            <button class="am-btn am-btn-default" type="button" onclick="serachinit()" >搜索</button>
          </span>
          </div>
        </div>
      </div>
      
 
      <div class="am-g" id="123">
        <div class="am-u-sm-12" id="main-content">
                 <li><a href='#'>2</a></li>
                  <li><a href='#'>3</a></li>
                  <li><a href='#'>4</a></li>
                  <li><a href='#'>5</a></li>

      </div>
    </div>

    <footer class="admin-content-footer">
    
    
      <hr>
      <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </footer>

  </div>
  <!-- content end -->
</div>

<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>

<footer>

	
  <hr>
  <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
</footer>

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->


</body>
</html>
